//
//  LCBaseModel.m
//  TheLCNews
//
//  Created by apple on 15/11/26.
//  Copyright © 2015年 LC. All rights reserved.
//

#import "LCBaseModel.h"

@implementation LCBaseModel

+ (NSMutableArray *)baseModelByArr:(NSArray *)arr{
    
    //先把数组初始化
    NSMutableArray *modelArr = [NSMutableArray array];
    
    //遍历数组
    for (NSDictionary *dic in arr) {
        @autoreleasepool {
            
            
            //通过遍历构造器来创建对象
            //获取当前类型
            id model = [[self class] baseModelWithDic:dic];
            
            [modelArr addObject:model];
        }
        
    }
    
    return modelArr;
}

+(instancetype)baseModelWithDic:(NSDictionary *)dic{
    //通过多台创建对象
    id model = [[[self class] alloc]initWithDic:dic] ;
    
    
    
    return model;
}

//初始化方法

-(instancetype)initWithDic:(NSDictionary *)dic{
    self = [super init];
    if (self) {
        //进行KVC的赋值
        
        
        [self setValuesForKeysWithDictionary:dic];
        
        
    }
    
    return self;
    
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}




@end
